package cn.service;

import cn.dao.UserDao;
import cn.entity.Page;
import cn.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    @Qualifier("userDao")
    private UserDao userDao;
    public List<User> getUserList(Page page){
       List<User> userList =  userDao.getUserList(page);
        return  userList;
    }

    @Override
    public int getUserNum(User user) {
        int num = userDao.getUserNum(user);
        return num;
    }

    @Override
    public boolean addUser(User user) {
        boolean b = userDao.addUser(user);
        return b;
    }

    @Override
    public User getUserbyId(User user) {
       User user1 =  userDao.getUserbyId(user);
        return user1;
    }

    @Override
    public boolean deleterUser(User user) {
      boolean b=  userDao.deleterUser(user);
        return b;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
